/*************************************************************************
    > File Name: program_text_data_end_segment.c
    > Author:		
    > Mail:		
    > Created Time: 2021年03月21日 星期日 18时27分16秒
 ************************************************************************/

#include <stdio.h>

/*
 * SECTIONS
{
  .text :
  {
    start = . ;
    _start = . ;
    __start = . ;
    *(.text)
    etext = . ;
  }
  .data :
  {
    __data_start__ = . ;
    *(.data)
    __data_end__ = . ;
    __rdata_start__ = . ;
    *(.rdata)
    __rdata_end__ = . ;
    *(.pdata)
    edata = . ;
    _edata = . ;
    __edata = . ;
  }
  .bss :
  {
    __bss_start__ = . ;
    *(.bss)
    __common_start__ = . ;
    *(COMMON)
    __bss_end__ = . ;
  }
  .edata :
  {
    *(.edata)
    end = . ;
    _end = . ;
    __end = . ;
  }

 *
 */

extern char etext;
extern char edata;
extern char end;

int main(int argc, char *argv[])
{

	printf("Show the %s segmentation!\n", argv[0]);

	printf("Progrma text segment:0x%10p\n", &etext);
	printf("Progrma data segment:0x%10p\n", &edata);
	printf("Progrma end  segment:0x%10p\n", &end);
	return 0;
}
